<?php

namespace App\Service\User;

use App\Model\DiscountVideoUsers;
use App\Model\UserProfile;

class DiscountVideoStatusService extends UserBaseService
{
    public function handle()
    {
        $userId = $this->getUserId();

        $gender = UserProfile::getGender($userId);

        $status = 0;
        if ($gender == 1) {
            if (DiscountVideoUsers::checkShowPermissions($userId)) {
                $status = 1;
            }
        } else {
            if (DiscountVideoUsers::getLog($userId)) {
                $status = 2;
            } elseif (DiscountVideoUsers::checkShowRankPermissionsV2($userId)) {
                $status = 1;
            }
        }

        return ['status' => $status];
    }
}
